package com.cg.design.depthdesign.command.commands;

import com.cg.design.depthdesign.command.editor.Editor;

/**
 * 将所选文字复制到剪贴板
 *
 * @program: LeetCode->CopyCommand
 * @author: cg
 * @create: 2022-04-05 18:12
 **/
public class CopyCommand extends Command {

    public CopyCommand(Editor editor) {
        super(editor);
    }

    /**
     * 复制命令不会被保存到历史记录中，因为它没有改变编辑器的状态。
     *
     * @return
     */
    @Override
    public boolean execute() {
        editor.clipboard = editor.textField.getSelectedText();
        return false;
    }
}
